package com.jinxiangyang.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jinxiangyang.domain.Student;
import com.jinxiangyang.service.StudentService;
import com.jinxiangyang.mapper.StudentMapper;
import com.jinxiangyang.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author jinxiangyang
* @description 针对表【student】的数据库操作Service实现
* @createDate 2023-08-17 19:20:15
*/
@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student>
    implements StudentService{



    @Autowired
    private StudentMapper studentMapper;


    @Override
    public IPage<Student> getStudentByPageAndLike(Integer pageNumber, Integer pageSize, Student student){
        IPage<Student> ipge = new Page<>(pageNumber, pageSize);
        LambdaQueryWrapper<Student> lambdaQueryWrapper = new LambdaQueryWrapper<Student>();
        lambdaQueryWrapper.like(StringUtils.isNotEmpty(student.getType()),Student::getType, student.getType());
        lambdaQueryWrapper.like(StringUtils.isNotEmpty(student.getRelName()),Student::getRelName,student.getRelName());
        lambdaQueryWrapper.like(StringUtils.isNotEmpty(student.getSpecialized()),Student::getSpecialized,student.getSpecialized());
        return studentMapper.selectPage(ipge, lambdaQueryWrapper);
    }











}




